|
900612 ESP -- SURF Center : Parsing the Raw ESP Log File Format
This page last changed on Oct 12, 2011 by kgomes.
This page is intended to provide just enough information about the ESP's raw file format so that the ESP GUI can parse it to extract time and data management entries. More complete documentation is available in MBARI's CVS repository in the file: ESP/gen2/software/esp/lib/log.rb. The raw, real-time log is typically named real.log. The actual log file name is determined by the mode of ESP operation that generated it. A quick simulation log of a mission would be written to quick.log, for example. A real-time simulation would be written to simreal.log
All raw log files consist of a series of log entries, each of which is separated by a single ASCII linefeed (0x0a) character. Each log entry line begins with a byte that denotes its type. This simple record structure allows one to easily skip over types of log entries they do not recognize. The types of log entries that the GUI will probably want to process are timestamp, time_mark,time_increment, alias_definition and gui_data records. These log enties conform to the following grammar:
Non-terminals: (terminal symbols enclosed in <>) digit = <0>..<9> capital = <A>..<Z> alpha = capital | <a>..<z> timezone = capital[capital]?[capital]? #Ex. GMT, PST, PDT, Z moniker = alpha|digit character = <any byte except <">, <\>, <linefeed>> | <\><"> | <\><\> | <\><linefeed> string = [character]+ actor = <">string<">|moniker|<\>
Log entries: time_mark = <@>digit*[<.>digit+]?timezone #Ex. 3.14PST, .1PST, 999.01GMT, 1232498793.34PST timestamp = <@>timezone?digit*[<.>digit+]?[</>digit*[<.>digit+]?]? #Ex. 3.14, .1, 999.01, PST1232498793.34/100.0 time_increment = <+>digit* #Ex. 3, 0, 100 alias = <=>moniker?[<">string<">]? #Ex. =tMAIN, =hcore, =ECan gui_data = <`>actor?string #not context free, see notes below
Grammar Notes: The actor non-terminal token in the gui_data production may be omitted if the first character of the following string is not equal to any moniker defined in a previous alias_definition. Otherwise, the placeholder actor <\> must be inserted before the string. An alias without a "string" deletes the alias associated with the indicated moniker A alias missing moniker (and "string") deletes all aliases. time_increment with no digits <+> is equivalent to +1 tic.
Example raw gui_data log entries: `arbitrary text `"thread_name"arbitrary text #switched to thread_name `\Sam is cool #There is an actor whose moniker is 'S', so it must be escaped `\Saturday symphony \ on the lawn \ in the park. #multiline text
Tracking Log Time: timestamps: Set the current log time.
time_increments: Increment the current real or simulated log time by specified number of tics.
time_marks: Indicate the Real-time at which the entry was generated.
Each log entry has a "context" that consists of its log time and the actor that wrote it.
Initialize log entry context upon raw log file open: logTime = 0 timeZone=:simulated actors = {} #empty hash actor = "" ticsPerSecond = 100 #default tics per second
GetNextGuiDataText:
loop do case (entry type) when timestamp: logTime = epoch seconds specified if (zone specified) timeZone=zone from timestamp if (ticsPerSecond specified) continue; when time_increment: if increment specified logTime += specified increment / ticsPerSecond else logTime += 1 / ticsPerSecond round logTime to the nearest tic continue; when alias: if (moniker present) if (string present) actors[moniker] = string else actors.delete moniker else actors.clear #delete all monikers from hash continue; when gui_data: c = character following <`> if (c == <"> ) actor = text between quotes else if (c == <\>) return next character to end of entry else if moniker[c] exists actor = moniker[c] return next character to end of entry else return c + next character to end of entry end #case end #loop Parsing RulesGiven the above information, here are the rules that will be applied to parsing a raw log file (.log):
Assumptions
Graphical FormThe flow of a ESP log might look something like:
|
| Document generated by Confluence on Feb 03, 2026 14:16 |